import { BasicColumn, FormSchema } from '@/components/Table';
import { h, ref } from 'vue';
import { Tag } from 'ant-design-vue';
import { departmentTreeList } from '@/api/sys/msUser';
import { ywGroupSelectList } from '@/api/heng/ywManage';

import { useUserStore } from '@/store/modules/user';
const userStore = useUserStore();

//表格列名
export const columns: BasicColumn[] = [
  {
    title: '介绍人名称',
    dataIndex: 'introduceUserName',
    width: 130,
  },
  {
    title: '介绍人工号',
    dataIndex: 'introduceUserNo',
    width: 150,
  },
  {
    title: '客户编号',
    dataIndex: 'customerNo',
    width: 150,
  },
  {
    title: '抽成比例',
    dataIndex: 'introduceUserRate',
    format: (value) => `${value ? value + '%' : ''}`,
    width: 120,
  },
  {
    title: '结算截至时间',
    width: 180,
    dataIndex: 'endTime',
  },
  {
    title: '创建时间',
    width: 180,
    dataIndex: 'createTime',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'keyword',
    label: '搜索',
    component: 'Input',
    colProps: { span: 8 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: 'id',
    show: false,
  },
  {
    field: 'introduceUserNo',
    label: 'introduceUserNo',
    show: false,
  },
  {
    field: 'introduceUserName',
    label: '介绍人名称',
    required: true,
    slot: 'introduceUserSlot',
  },
  {
    field: 'introduceUserRate',
    label: '抽成比例',
    component: 'InputNumber',
    required: true,
    suffix: '%',
    componentProps: {
      min: 0,
      max: 100,
    },
  },
  {
    field: 'customerNo',
    label: '客户编号',
    component: 'Input',
  },
  {
    field: 'endTime',
    label: '结算截至日期',
    component: 'DatePicker',
    required: true,
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      // valueFormat: 'YYYY-MM-DD',
    },
  },
];
